@echo off

echo Stop %OrchardService%...
call BVTscripts\WebServer.bat %OrchardService% stop
echo.

set DIR=%CD%
echo Begin to instrument dlls...
cd /d %OrchardWebBin%
set VsInstr="%VSINSTALLDIR%\Team Tools\Performance Tools\VsInstr.exe"

%VsInstr% -coverage Orchard.exe
%VsInstr% -coverage Orchard.core.dll
%VsInstr% -coverage Orchard.framework.dll
%VsInstr% -coverage Orchard.web.dll

%VsInstr% -coverage %Modules%\Orchard.ArchiveLater\bin\Orchard.ArchiveLater.dll

%VsInstr% -coverage %Modules%\Orchard.Blogs\bin\Orchard.Blogs.dll

%VsInstr% -coverage %Modules%\Orchard.CodeGeneration\bin\Orchard.CodeGeneration.dll

%VsInstr% -coverage %Modules%\Orchard.Comments\bin\Orchard.Comments.dll

%VsInstr% -coverage %Modules%\Orchard.ContentTypes\bin\Orchard.ContentTypes.dll

%VsInstr% -coverage %Modules%\Orchard.Email\bin\Orchard.Email.dll

%VsInstr% -coverage %Modules%\Orchard.ImportExport\bin\Orchard.ImportExport.dll

%VsInstr% -coverage %Modules%\Orchard.Indexing\bin\Orchard.Indexing.dll

%VsInstr% -coverage %Modules%\Orchard.Lists\bin\Orchard.Lists.dll

%VsInstr% -coverage %Modules%\Orchard.Localization\bin\Orchard.Localization.dll

%VsInstr% -coverage %Modules%\Orchard.Media\bin\Orchard.Media.dll

%VsInstr% -coverage %Modules%\Orchard.MediaPicker\bin\Orchard.MediaPicker.dll

%VsInstr% -coverage %Modules%\Orchard.Messaging\bin\Orchard.Messaging.dll

%VsInstr% -coverage %Modules%\Orchard.Migrations\bin\Orchard.Migrations.dll

%VsInstr% -coverage %Modules%\Orchard.Modules\bin\Orchard.Modules.dll

%VsInstr% -coverage %Modules%\Orchard.MultiTenancy\bin\Orchard.MultiTenancy.dll

%VsInstr% -coverage %Modules%\Orchard.Packaging\bin\Orchard.Packaging.dll

%VsInstr% -coverage %Modules%\Orchard.Pages\bin\Orchard.Pages.dll

%VsInstr% -coverage %Modules%\Orchard.PublishLater\bin\Orchard.PublishLater.dll

%VsInstr% -coverage %Modules%\Orchard.Recipes\bin\Orchard.Recipes.dll

%VsInstr% -coverage %Modules%\Orchard.Roles\bin\Orchard.Roles.dll

%VsInstr% -coverage %Modules%\Orchard.Scripting\bin\Orchard.Scripting.dll

%VsInstr% -coverage %Modules%\Orchard.Scripting.Dlr\bin\Orchard.Scripting.Dlr.dll

%VsInstr% -coverage %Modules%\Orchard.Search\bin\Orchard.Search.dll

%VsInstr% -coverage %Modules%\Orchard.Setup\bin\Orchard.Setup.dll

%VsInstr% -coverage %Modules%\Orchard.Tags\bin\Orchard.Tags.dll

%VsInstr% -coverage %Modules%\Orchard.Themes\bin\Orchard.Themes.dll

%VsInstr% -coverage %Modules%\Orchard.Users\bin\Orchard.Users.dll

%VsInstr% -coverage %Modules%\Orchard.Warmup\bin\Orchard.Warmup.dll

%VsInstr% -coverage %Modules%\Orchard.Widgets\bin\Orchard.Widgets.dll

%VsInstr% -coverage %ORCHARD%\src\Tools\Orchard\bin\Debug\Orchard.exe

echo Dlls instrumented successfully...

echo Start profile monitor...
set VsPerfCmd="%VSINSTALLDIR%\Team Tools\Performance Tools\VSPerfCmd.exe"
%VsPerfCmd% /START:COVERAGE /OUTPUT:"%OrchardWebBin%\Orchard.coverage" /CS
echo Profile monitor successfully started...

cd /d %DIR%

echo Start %OrchardService%...
call BVTscripts\WebServer.bat %OrchardService% start
echo.